<?php
$status=array('0'=>lang_show('notpass'),'1'=>lang_show('auditpass')); 
if(isset($_GET["step"]))
{
	if($_GET["step"]=="del")
	{
		$db->query("delete from ".BUSINESS." where id='$_GET[deid]'");
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE><?php echo lang_show('admin_system');?></TITLE> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/prototype.js"></script>
<script type="text/javascript" src="main.js"></script>
</HEAD>
<body>

<div class="bigbox">
	<div class="bigboxhead"><?php echo lang_show('business_info_list');?></div>
	<div class="bigboxbody">
	<form method="get" action="">
          <table width="98%" border="0" cellspacing="0" cellpadding="0">
            <tr style="margin:0; padding:0;">
               <td class="searh_left"><?php echo lang_show('key_word');?></td>
               <td>
			   <input class="text" type="text" name="key" value="<?php if(isset($_GET["key"]))echo $_GET["key"];?>">
               <input name="m" type="hidden" value="company" />
               <input name="s" type="hidden" value="business_info_list.php" />
			   </td>
             </tr>
             <tr>
               <td><?php echo lang_show('statu');?></td>
               <td>
				   <select class="select" name="statu">
				   <option value="0"><?php echo $status[0];?></option>
				   <option <?php if($_GET['statu']==1) echo 'selected="selected"';?> value="1"><?php echo $status[1];?></option>
				   </select>
			   </td>
             </tr>
             <tr>
               <td>&nbsp;</td>
               <td><input class="btn" type="submit" name="Submit" value="<?php echo lang_show('search');?>"></td>
             </tr>
           </table>
		</form>
  <table width="100%" border="0" cellpadding="2" cellspacing="0" >
    <tr class="theader"> 
      <td width="116"><?php echo lang_show('business_info_name');?>  </td>
      <td width="170"><?php echo lang_show('business_info_uptime');?></td>
      <td width="348"><?php echo lang_show('business_info_com');?></td>
      <td width="132"><?php echo lang_show('business_info_regtime');?></td>
      <td width="78"><?php echo lang_show('statu');?></td>
      <td width="108" align="center" ><?php echo lang_show('manager');?></td>
      </tr>
    <?php
	if(isset($_GET["key"]))
		$psql=" and (b.company like '%$_GET[key]%') ";
	if(!empty($_SESSION["province"]))
		$psql.=" and b.province='$_SESSION[province]'";
	if(!empty($_SESSION["city"]))
		$psql.=" and b.city='$_SESSION[city]'";
	if(!empty($_GET['statu']))
		$psql.=" and statu='$_GET[statu]'";
	$sql="SELECT a.*,b.company FROM ".BUSINESS." a,".USER." b WHERE
	  	a.userid=b.userid $psql order by id desc ";
	//=============================
	include_once("../includes/page_utf_class.php");
	$page = new Page;
	$page->listRows=20;
	if (!$page->__get('totalRows')){
		$db->query($sql);
		$page->totalRows = $db->num_rows();
	}
	$sql .= "  limit ".$page->firstRow.",20";
	$pages = $page->prompt();
	//=====================
	$db->query($sql);
	$re=$db->getRows();
	$coun_num=$db->num_rows();
	for($i=0;$i<$coun_num;$i++)
	{ 
	?> 
      <tr  onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this,'odd')"> 
        <td><?php echo $re[$i]["person_name"]; ?></td>
        <td align="left"><?php echo $re[$i]["uptime"]; ?></td>
        <td align="left"><?php echo $re[$i]["company"]; ?></td>
        <td align="left"><?php echo $re[$i]["com_reg_time"]; ?></td>
        <td><?php $key=$re[$i]['statu'];echo $status[$key]; ?></td>
        <td align="center"> 
        <a href="module.php?m=company&s=business_info_detail.php&id=<?php echo $re[$i]["id"]; ?>"><?php echo $editimg;?></a>  
        <a href="module.php?m=company&s=business_info_list.php&step=del&deid=<?php echo $re[$i]["id"]; ?>" onClick="return confirm('<?php echo lang_show('are_you_sure');?>')"><?php echo $delimg;?></a>
		</td>
		</tr>
        <?php 
    	}
		?>
      <tr>
        <td colspan="6" align="right"><div class="page"><?php echo $pages?></div></td>
      </tr>
  </table>
  </div>
</div>
</body>
</html>
